package com.wrx.club_management_backend.utils;

import com.wrx.club_management_backend.dto.UserDTO;

/**
 * 线程本地变量，存储UserDTO
 */
public class UserHolder {
    private static final ThreadLocal<UserDTO> tl = new ThreadLocal<>();

    public static void saveUser(UserDTO dto){
        tl.set(dto);
    }

    public static UserDTO getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
